package org.groupg.project.config;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;

public class RuleConfig {
    @JacksonXmlProperty(localName = "name")
    private String name;

    @JacksonXmlProperty(localName = "matchPattern")
    private String matchPattern;

    @JacksonXmlProperty(localName = "targetHost")
    private String targetHost;

    @JacksonXmlProperty(localName = "targetPort")
    private int targetPort;

    @JacksonXmlProperty(localName = "ssl", isAttribute = false)
    private boolean ssl = false;

    @JacksonXmlProperty(localName = "rewritePattern")
    private String rewritePattern = "";

    @JacksonXmlProperty(localName = "order")
    private int order = 0;

    // 构造方法、getters和setters
    public RuleConfig() {}

    public RuleConfig(String name, String matchPattern, String targetHost, int targetPort) {
        this(name, matchPattern, targetHost, targetPort, false, "", 0);
    }

    public RuleConfig(String name, String matchPattern, String targetHost,
                     int targetPort, boolean ssl, String rewritePattern, int order) {
        this.name = name;
        this.matchPattern = matchPattern;
        this.targetHost = targetHost;
        this.targetPort = targetPort;
        this.ssl = ssl;
        this.rewritePattern = rewritePattern;
        this.order = order;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMatchPattern() {
        return matchPattern;
    }

    public void setMatchPattern(String matchPattern) {
        this.matchPattern = matchPattern;
    }

    public String getTargetHost() {
        return targetHost;
    }

    public void setTargetHost(String targetHost) {
        this.targetHost = targetHost;
    }

    public int getTargetPort() {
        return targetPort;
    }

    public void setTargetPort(int targetPort) {
        this.targetPort = targetPort;
    }

    public boolean isSsl() {
        return ssl;
    }

    public void setSsl(boolean ssl) {
        this.ssl = ssl;
    }

    public String getRewritePattern() {
        return rewritePattern;
    }

    public void setRewritePattern(String rewritePattern) {
        this.rewritePattern = rewritePattern;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }
}